﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="RecepcionarAutorizacion.aspx.cs" Inherits="SolicitudAutorizacion.RecepcionarAutorizacion" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Label ID="Label1" runat="server" Text="Numero Radicado:"></asp:Label>
    <asp:TextBox ID="txtradicado" ClientIDMode="Static" runat="server" Width="223px"></asp:TextBox>
&nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label9" runat="server" Text="Fecha Diligenciamiento:"></asp:Label>
    <asp:TextBox ID="txtfecha" ClientIDMode="Static" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Label ID="Label2" runat="server" Text="Identificacion:"></asp:Label>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="txtidentificacion" ClientIDMode="Static" runat="server" Width="183px"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label3" runat="server" Text="Nombre:"></asp:Label>
    &nbsp;&nbsp;
    <asp:TextBox ID="txtnombre" ClientIDMode="Static" runat="server"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label4" runat="server" Text="Apellido:"></asp:Label>
    &nbsp;&nbsp;
    <asp:TextBox ID="txtapellido" ClientIDMode="Static" runat="server"></asp:TextBox>
    <br />
    <asp:Label ID="Label5" runat="server" Text="Direccion:"></asp:Label>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="txtdireccion" ClientIDMode="Static" runat="server"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label6" runat="server" Text="Ciudad:"></asp:Label>
    &nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="txtciudad" ClientIDMode="Static" runat="server"></asp:TextBox>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label12" runat="server" Text="Edad:"></asp:Label>
    <asp:TextBox ID="txtedad" ClientIDMode="Static" runat="server"></asp:TextBox>
    <br />
    <asp:Label ID="Label7" runat="server" Text="Telefono:"></asp:Label>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="txttelefono" ClientIDMode="Static" runat="server"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="Label8" runat="server" Text="Sexo:"></asp:Label>   M <asp:RadioButton ID="rbm" runat="server" />  F&nbsp; <asp:RadioButton ID="rbf" runat="server" />
    <br />
    <asp:Label ID="Label10" runat="server" Text="IPS:"></asp:Label>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="txtips" ClientIDMode="Static" runat="server"></asp:TextBox>
    <br />
    <asp:Label ID="Label11" runat="server" Text="Tipo solicitud:"></asp:Label>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="txttipo" ClientIDMode="Static" runat="server"></asp:TextBox>
    <br />
    <asp:Label ID="Label13" runat="server" Text="Descripcion:"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="txtdescripcion" ClientIDMode="Static" runat="server" TextMode="MultiLine"></asp:TextBox>
    <br />
    <br />
    <asp:Button ID="btguardar" runat="server" Text="Guardar" />
    <br />
    <br />
    <script src="Scripts/jquery-1.7.1.js"></script>
    <script>    
        var ban = true;

        function Buscar() {
            //email = document.getElementById('<%=Label13.ClientID%>');
            //alert(email.innerText);
           
               $.ajax({
                   type: "GET",
                   url: "/RecepcionarAutorizacion.aspx/GetSolicitud",
                   contentType: "application/json; charset=utf-8",
                   dataType: "json",
                   async: true,
                   success: function (result) {
                        var Icontrol = (typeof result.d) == 'string' ? eval('(' + result.d + ')') : result.d;
                        //alert(Icontrol.indentificacion);
                        if ((Icontrol.indentificacion.length > 0) && (ban == true)) {
                          var truthBeTold = window.confirm('Tiene una solicitud. Desea Tomarla?');
                          if (truthBeTold) {
                              ban = false;
                              $("#txtidentificacion").val(Icontrol.indentificacion);
                              $("#txtfecha").val(Icontrol.fecha);
                              $("#txtnombre").val(Icontrol.nombre);
                              $("#txtapellido").val(Icontrol.apellido);
                              $("#txtdireccion").val(Icontrol.direccion);
                              $("#txtciudad").val(Icontrol.ciudad);
                              $("#txtedad").val(Icontrol.edad);
                              $("#txttelefono").val(Icontrol.telefono);
                              $("#txtips").val(Icontrol.ips);
                              $("#txtdescripcion").val(Icontrol.descripcion);
                              $("#txttipo").val(Icontrol.tiposolicitud);                             
                           }
                          
                   }
                       //alert(JSON.stringify(result.d));
                     
                                          
                   },
                   error: function (jqXHR, status, error) {
                       alert(error + "-" + jqXHR.responseText);
                   }
               });


           }
        setInterval(Buscar, 3000);
    </script>
</asp:Content>
